<import file="block/common.html" name="url" :tpl_cfg="['urlName'=>$title,'backList'=>'返回列表']"/>
<div class="layui-fluid">
    <div class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">标题</label>
            <div class="layui-input-inline">
                <input type="text" name="title" lay-verify="required" lay-reqtext="标题不能为空" placeholder="请输入标题"
                    value="<{$feedback['title']??''}>" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">提交人</label>
            <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required" lay-reqtext="提交人不能为空" placeholder="提交人不能为空"
                    value="<{$feedback['name']??''}>" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">提交人联系电话</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" lay-verify="required" lay-reqtext="提交人联系电话不能为空" placeholder="提交人联系电话不能为空"
                    value="<{$feedback['phone']??''}>" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">内容</label>
            <div class="layui-input-block">
                <textarea name="content" class="layui-textarea" placeholder="请输入内容"><{$feedback['content']??''}></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">意见显示状态</label>
            <div class="layui-input-block">
                <input type="radio" name="status" value="1" title="显示"
                    <?php if(!empty($feedback)){echo $feedback["status"] ==1?'checked=""':'';} ?>>
                <input type="radio" name="status" value="0" title="不显示"
                    <?php if(!empty($feedback)){echo $feedback["status"] ==0?'checked=""':'';} ?>>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">回复内容</label>
            <div class="layui-input-block">
                <textarea name="re_content" class="layui-textarea" placeholder="请输入内容"><{$feedback['re_content']??''}></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">回复显示状态</label>
            <div class="layui-input-block">
                <input type="radio" name="re_status" value="1" title="显示"
                    <?php if(!empty($feedback)){echo $feedback["re_status"] ==1?'checked=""':''; }?>>
                <input type="radio" name="re_status" value="0" title="不显示"
                    <?php if(!empty($feedback)){echo $feedback["re_status"] ==0?'checked=""':''; }?>>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="hidden" name="id" value="<{$feedback['id']??''}>">
                <button class="layui-btn" lay-submit lay-filter="saveBtn"><i class="layui-icon">&#x1005;</i><?php echo lang('save');?></button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.define(function () {
        var form = layui.form,
            layer = layui.layer,
            upload = layui.upload,
            $ = layui.$;

        form.render();

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.post('<{CAUrl("feedback",ROUTE["act"])}>', data.field, function (res) {
                if (res.status == 1) {
                    layer.msg(res.info, { icon: 1, time: 1000 }, function () {
                        loadMain('<{CAUrl("feedback","index")}>');
                    });
                } else {
                    layer.msg(res.info, { icon: 2, anim: 6, time: 5000 });
                }
            });
            return false;
        });

    });
</script>